<?php

// uncomment the following to define a path alias
// Yii::setPathOfAlias('local','path/to/local-folder');

// This is the main Web application configuration. Any writable
// CWebApplication properties can be configured here.
require_once('functions.php');
if(fn::is_localhost()) {
	$theString = 'mysql:host=localhost;dbname=cabsgamers';
	$theName = 'root';
	$thePass = '';
} else {
	$theString = 'mysql:host=buckeyeboardgamers.ipowermysql.com;dbname=cabsweb';
	$theName = 'cabsdb';
	$thePass = 'QueSta';
}

return array(
	'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',
	'name'=>'Columbus Area Boardgaming Society',
	'theme'=>'cabs',
	'defaultController' => 'page/home',

	// preloading components
	'preload'=>array('log','bootstrap'),
	
	// autoloading model and component classes
	'import'=>array(
		'application.models.*',
		'application.components.*',
		/*'application.components.widgets.*',*/
		'application.modules.rights.*',
		'application.modules.rights.components.*',
		'application.modules.user.models.*',
		'application.modules.user.components.*',
		'ext.redactor.ImperaviRedactorWidget',
		/*'application.vendors.authnet.*',
		'ext.mail.YiiMailMessage',*/
	),

	'modules'=>array(
		'user'=>array(
			'tableUsers' => 'cabs_users',
			'tableProfiles' => 'cabs_profiles',
			'tableProfileFields' => 'cabs_profiles_fields',
		),
		'rights'=>array(
			'install'=>false,
		),
		'gii'=>array(
			'class'=>'system.gii.GiiModule',
			'password'=>'Cabs123!',
			// If removed, Gii defaults to localhost only. Edit carefully to taste.
			'ipFilters'=>array('127.0.0.1','::1'),
			'generatorPaths'=>array(
				'bootstrap.gii',
			),
		),
		'forum'=>array(
			'class'=>'application.modules.forum.YiiForumModule',
		),
		
	),

	// application components
	'components'=>array(
		'user'=>array(
			'class'=>'RWebUser',
			// enable cookie-based authentication
			'allowAutoLogin'=>true,
            		'loginUrl'=>array('/user/login'),
		),
		// uncomment the following to enable URLs in path-format
		
		'urlManager'=>array(
			/*'class'=>'CabsUrlManager',*/
			'urlFormat'=>'path',
			'showScriptName'=>false,
			'rules'=>array(
				'<controller:\w+>/<id:\d+>'=>'<controller>/view',
				'<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
				'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
				'home'=>'page/home',
				'about'=>'page/about',
				'calendar'=>'page/calendar',
				'location'=>'page/location',
				'membership'=>'page/membership',
				'contact'=>'page/contact',
				'page/<slug:[a-zA-Z0-9-]+>'=>'page/view',
				'news/<slug:[a-zA-Z0-9-]+>'=>'news/view',
			),
			/*
			'hostInfo' => 'http://cabsgamers.org',
			'secureHostInfo' => 'https://cabsgamers.org',
			'secureRoutes' => array(
				'user/login',
			),
			*/
		),
		/*
		'db'=>array(
			'connectionString' => 'sqlite:'.dirname(__FILE__).'/../data/testdrive.db',
		),
		*/
		// uncomment the following to use a MySQL database
		
		'db'=>array(
			'connectionString' => $theString,
			'emulatePrepare' => true,
			'username' => $theName,
			'password' => $thePass,
			'charset' => 'utf8',
		),
		'session' => array(
			'class' => 'CDbHttpSession',
			'autoCreateSessionTable' => false,
			'connectionID' => 'db',
			'sessionTableName' => 'cabs_yiisession',
			'useTransparentSessionID' => ($_POST['PHPSESSID']) ? true : false,
			'cookieMode' => 'only',
			'timeout'=>86400,
		),
		'authManager'=>array(
			'class'=>'RDbAuthManager', // Database driven Yii-Auth Manager
			'connectionID'=>'db', // db connection as above
			'defaultRoles'=>array('registered'), // default Role for logged in users
			'showErrors'=>true, // show eval()-errors in businessRules
		),		
		'errorHandler'=>array(
			// use 'site/error' action to display errors
			'errorAction'=>'site/error',
		),
		'log'=>array(
			'class'=>'CLogRouter',
			'routes'=>array(
				array(
					'class'=>'CFileLogRoute',
					'levels'=>'error, warning',
				),
				// uncomment the following to show log messages on web pages
				/*
				array(
					'class'=>'CWebLogRoute',
				),
				*/
			),
		),
		'bootstrap'=>array(
			'class'=>'ext.bootstrap.components.Bootstrap',
			'responsiveCss'=>true,
		),
		/*
		'mail' => array(
				'class' => 'ext.mail.YiiMail',
				'transportType' => 'smtp',
				'transportOptions' => array(
						'host'=>'SECURE.EMAILSRVR.COM',
						'username'=>'stephen.schaefer@playpon.com',
						'password'=>'Dev!23',
						'port'=>'465',
						'encryption'=>'ssl'
				),
				'viewPath' => 'application.views.mail',
				'logging' => true,
				'dryRun' => false
		),
		*/
	),

	// application-level parameters that can be accessed
	// using Yii::app()->params['paramName']
	'params'=>array(
		// this is used in contact page
		'adminEmail'=>'cabs.board@gmail.com',
	),
);